let nums = [1,3,-1,-3,2,3,6,7], k = 3
var maxSlidingWindow = function(nums, k) {
  const len = nums.length
  const res = []
  const deque = []
  for (let i = 0; i < len; i++) {
    while (deque.length && nums[deque[deque.length - 1]] < nums[i]) deque.pop()
    deque.push(i)
    while (deque[0] <= i - k) deque.shift()
    if (i >= k - 1) {
      res.push(nums[deque[0]])
    }
  }
  return res
};